Imports Clo = Enhancements.Core.Logging
Imports Fun = Enhancements.Basic.Expressions.Functions
Imports Ref = System.Reflection
Imports Sys = System

Namespace Enhancements.Basic.Expressions
    ''' <summary>The exception that is thrown when an expression subexpression contains adjacent values, variables or function calls tokens.</summary>
    <Serializable(), DebuggerStepThrough()> _
    Public NotInheritable Class CompilerExpressionSubexpressionContainsAdjacentValuesOrVariablesOrFunctionCallsException
        Inherits CompilerException

        Private Sub New(ByVal _expression As System.String, ByVal _subexpressionTokens() As Token)
            Expression = _expression
            SubexpressionTokens = _subexpressionTokens
        End Sub

        Private __Expression As System.String = Nothing
        ''' <summary>Gets the expression that caused this exception.</summary>
        Public Property Expression() As System.String
            Get
                Return __Expression
            End Get
            Private Set(ByVal _value As System.String)
                __Expression = _value
            End Set
        End Property

        Private __SubexpressionTokens() As Token = {}
        ''' <summary>Gets the subexpression tokens that caused this exception.</summary>
        Public Property SubexpressionTokens() As Token()
            Get
                Return __SubexpressionTokens
            End Get
            Private Set(ByVal _value() As Token)
                __SubexpressionTokens = _value
            End Set
        End Property

        ''' <summary>Throws an exception.</summary>
        ''' <param name="_expression">Expression that is causing the exception.</param>
        ''' <param name="_subexpressionTokens">Subexpression tokens that are causing the exception.</param>
        ''' <exception cref="CompilerExpressionSubexpressionContainsAdjacentValuesOrVariablesOrFunctionCallsException"> </exception>
        Friend Shared Sub ___Throw(ByVal _expression As System.String, ByVal _subexpressionTokens() As Token)
            Dim _exception As CompilerExpressionSubexpressionContainsAdjacentValuesOrVariablesOrFunctionCallsException = New CompilerExpressionSubexpressionContainsAdjacentValuesOrVariablesOrFunctionCallsException(_expression, _subexpressionTokens)

            Throw _exception
        End Sub

    End Class
End Namespace
